<?php
/* -------------------------------------------------------------------------------------
* 	ID:						$Id: product_info.php 471 2014-01-30 15:55:27Z phone.mueller@googlemail.com $
* 	Letzter Stand:			$Revision: 471 $
* 	zuletzt geaendert von:	$Author: siekiera $
* 	Datum:					$Date: 2014-01-30 15:55:27 +0000 (Thu, 30 Jan 2014) $
*
* 	SEO:mercari by Siekiera Media
* 	http://www.seo-mercari.de
*
* 	Copyright (c) since 2011 SEO:mercari
* --------------------------------------------------------------------------------------
* 	based on:
* 	(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	(c) 2002-2003 osCommerce - www.oscommerce.com
* 	(c) 2003     nextcommerce - www.nextcommerce.org
* 	(c) 2005     xt:Commerce - www.xt-commerce.com
*
* 	Released under the GNU General Public License
* ----------------------------------------------------------------------------------- */

require_once(DIR_FS_INC.'inc.check_categories_status.php');
require_once(DIR_FS_INC.'inc.get_vpe_name.php');
require_once(DIR_FS_INC.'inc.get_cross_sell_name.php');
require_once(DIR_FS_INC.'inc.add_js_plugin.php');
require_once(DIR_FS_INC.'functions.image.php');

$info_smarty = new Smarty();
$info_smarty->assign('tpl_path', 'templates/'.CURRENT_TEMPLATE.'/');
$group_check = '';

if (!is_object($product) || !$product->isProduct()) {
	$error = TEXT_PRODUCT_NOT_FOUND;
	include(DIR_WS_MODULES.FILENAME_ERROR_HANDLER);

} else {
	$info_smarty->assign('itemscope_product', $schema->ItemScope('product'));
	$info_smarty->assign('itemscope_offer', $schema->ItemScope('offer'));
	$info_smarty->assign('itemprop_name', $schema->ItemProp('name'));
	$info_smarty->assign('itemprop_img', $schema->ItemProp('image'));
	$info_smarty->assign('itemprop_desc', $schema->ItemProp('desc'));
	$info_smarty->assign('itemprop_price', $schema->ItemProp('price'));
	
	if(!empty($product->data['products_model']))
		$info_smarty->assign('itemprop_identifier_mpn', $schema->ItemProp('identifier_mpn', $product->data['products_model']));
	
	if(!empty($product->data['products_ean']))
		$info_smarty->assign('itemprop_identifier_ean', $schema->ItemProp('identifier_ean', $product->data['products_ean']));
	
	if(!empty($product->data['products_isbn']))
		$info_smarty->assign('itemprop_identifier_isbn', $schema->ItemProp('identifier_isbn', $product->data['products_isbn']));
	
	if($product->data['products_quantity'] > 1)
		$info_smarty->assign('itemprop_availability', $schema->ItemProp('availability'));

	$info_smarty->assign('itemprop_aggregaterating', $schema->ItemProp('aggregaterating'));
	
	if(ACTIVATE_NAVIGATOR == 'true')
		include (DIR_WS_MODULES.'product_navigator.php');

	$db->db_query("UPDATE
						".TABLE_PRODUCTS_DESCRIPTION."
					SET
						products_viewed = products_viewed+1
					WHERE
						products_id = '".$product->data['products_id']."'
					AND
						language_id = '".$_SESSION['languages_id']."'");
	
	$products_price_raw = $price->GetPrice($product->data['products_id'], true, (isset($_GET['qty']) ? $_GET['qty'] : 1), $product->data['products_tax_class_id'], '', 1, '','info');
	
	if(PRICE_AS_IMAGE == 'true')
		$products_price = $products_price_raw;
	else
		$products_price = $products_price_raw['formated'];

	if($_SESSION['customers_status']['customers_status_show_price'] != '0' && ALLOW_ADD_TO_CART == 'true') {
		if ($_SESSION['customers_status']['customers_fsk18'] == '1') {
			if ($product->data['products_fsk18'] == '0') {
				$info_smarty->assign('ADD_QTY', draw_input_field('products_qty', (isset($_GET['qty']) ? $_GET['qty'] : '1'), 'size="3" class="products_qty"').' '.draw_hidden_field('products_id', $product->data['products_id']));
				$info_smarty->assign('ADD_CART_BUTTON', '<button type="submit" name="add_to_cart" title="'.IMAGE_BUTTON_IN_CART.'" class="css_cart_img_button">'.IMAGE_BUTTON_IN_CART.'</button>');
				if(WHISLIST_BUTTON_SHOW == 'true')
					$info_smarty->assign('ADD_WISHLIST_BUTTON', '<a href="javascript:void(0)" title="'.TEXT_TO_WISHLIST.'" class="add_to_wislist product_info_wishlist_button">'.TEXT_TO_WISHLIST.'</a>');
			}
		} else {
			$info_smarty->assign('ADD_QTY', draw_input_field('products_qty', (isset($_GET['qty']) ? $_GET['qty'] : '1'), 'size="3" class="products_qty"').' '.draw_hidden_field('products_id', $product->data['products_id']));
			$info_smarty->assign('ADD_CART_BUTTON', '<button type="submit" name="add_to_cart" title="'.IMAGE_BUTTON_IN_CART.'" class="css_cart_img_button">'.IMAGE_BUTTON_IN_CART.'</button>');
			if(WHISLIST_BUTTON_SHOW == 'true')
				$info_smarty->assign('ADD_WISHLIST_BUTTON', '<a href="javascript:void(0)" title="'.TEXT_TO_WISHLIST.'" class="add_to_wislist product_info_wishlist_button">'.TEXT_TO_WISHLIST.'</a>');
		}
	}

	if($product->data['products_fsk18'] == '1')
		$info_smarty->assign('PRODUCTS_FSK18', 'true');

	if(ACTIVATE_SHIPPING_STATUS == 'true' && DELIVERY_SHOW == 'true') {
		$info_smarty->assign('SHIPPING_NAME', $main->getShippingStatusName($product->data['products_shippingtime']));
		$info_smarty->assign('SHIPPING_IMAGE', $main->getShippingStatusImage($product->data['products_shippingtime']));
		$info_smarty->assign('SHIPPING_IMAGE_DIMENSION', get_img_size($main->getShippingStatusImage($product->data['products_shippingtime'])));
	}
	
	$FORM_ACTION 	= draw_form('cart_quantity', href_link(FILENAME_PRODUCT_INFO, get_all_get_params(array('action', 'tmpl')).'action=add_product', 'SSL'),'POST', 'name="cart_quantity"')
								. draw_hidden_field('submit_target', 'cart')
								. draw_hidden_field('products_id', $product->data['products_id'])
								. draw_hidden_field('products_qty', '1');
				
	$info_smarty->assign('FORM_ACTION', $FORM_ACTION);
	$info_smarty->assign('FORM_END', '</form>');

	$info_smarty->assign('PRODUCTS_PRICE', $products_price);
	$info_smarty->assign('BUTTON_PLUS', '<a class="qty_plus products_qty_button no_target" href="'.href_link(FILENAME_PRODUCT_INFO, 'products_id='.$product->data['products_id'].'&qty='.(isset($_GET['qty']) ? ($_GET['qty']+1) : '2')).'">+</a>');
	$info_smarty->assign('BUTTON_MINUS', '<a class="qty_minus products_qty_button no_target" href="'.href_link(FILENAME_PRODUCT_INFO, 'products_id='.$product->data['products_id'].'&qty='.(isset($_GET['qty']) && $_GET['qty']!=1 ? ($_GET['qty']-1) : '1')).'">-</a>');
	
	if ($product->data['products_vpe_status'] == 1 && $product->data['products_vpe_value'] != 0.0 && $products_price_raw['plain'] > 0)
		$info_smarty->assign('PRODUCTS_VPE', $product->getVPEtext($product->data, $products_price_raw['plain']));
	
	$info_smarty->assign('PRODUCTS_ID', $product->data['products_id']);
	$info_smarty->assign('PRODUCTS_NAME', $product->data['products_name']);
	if ($_SESSION['customers_status']['customers_status_show_price'] != 0) {
		//$tax_rate = $price->TAX[$product->data['products_tax_class_id']];
		$tax_info = get_tax_description($product->data['products_tax_class_id']);
		//$tax_info = $main->getTaxInfo($tax_rate);
		$info_smarty->assign('PRODUCTS_TAX_INFO', $tax_info);
		$info_smarty->assign('PRODUCTS_SHIPPING_LINK', $main->getShippingLink());
	}
	if(STOCK_SHOW == 'true')
		$info_smarty->assign('PRODUCTS_STOCK_IMG', $product->getStockImg($product->data['products_quantity']));
	
	if(ARTICLE_NR_SHOW == 'true')
		$info_smarty->assign('PRODUCTS_MODEL', $product->data['products_model']);

	if(EAN_NR_SHOW == 'true')
		$info_smarty->assign('PRODUCTS_EAN', $product->data['products_ean']);

	if(ISBN_NR_SHOW == 'true')
		$info_smarty->assign('PRODUCTS_ISBN', $product->data['products_isbn']);

	$info_smarty->assign('PRODUCTS_QUANTITY', $product->data['products_quantity']);

	if(WHEIGT_SHOW == 'true' && ($product->data['products_weight'] != 0))
		$info_smarty->assign('PRODUCTS_WEIGHT', $product->data['products_weight']);
	
	if(BRAND_ON_INFO_SITE == 'true' && !empty($product->data['brand_id'])) {
		$brand = get_brand_data($product->data['brand_id']);
		$info_smarty->assign('BRAND_NAME', $brand['name']);
		if(!empty($brand['image']))
			$info_smarty->assign('BRAND_IMAGE', $brand['image']);
		if(!empty($brand['url']))
			$info_smarty->assign('BRAND_URL', href_link(FILENAME_REDIRECT,'action=brand&brand='.$brand['id']));
	}
	
	$info_smarty->assign('PRODUCTS_BASIS_URL', href_link(FILENAME_PRODUCT_INFO, 'products_id='.$product->data['products_id_base'], 'NONSSL', true, false));
	$_cat_link = explode('/', $info_smarty->getTemplateVars('PRODUCTS_BASIS_URL'));
	array_pop($_cat_link);
	$info_smarty->assign('PRODUCTS_CAT_URL', implode('/', $_cat_link).'/');

	//$info_smarty->assign('BACK_BUTTON', '<a title="'.IMAGE_BUTTON_BACK.'" href="'.href_link(FILENAME_DEFAULT, 'cPath='.$_GET['cPath']).'"><span class="css_img_button">'.IMAGE_BUTTON_BACK.'</span></a>');
	$info_smarty->assign('PRODUCTS_STATUS', $product->data['products_status']);
	$info_smarty->assign('PRODUCTS_ORDERED', $product->data['products_ordered']);
	$info_smarty->assign('PRODUCTS_TAGS', $product->getTagCloud());

	if(PRINT_BUTTON_SHOW == 'true')
		$info_smarty->assign('PRODUCTS_PRINT', '<a href="javascript:void(0)" class="product_info_print_button" onclick="javascript:window.open(\''.href_link(FILENAME_PRINT_PRODUCT_INFO, 'products_id='.$product->data['products_id']).'\', \'popup\', \'toolbar=0, width=640, height=600\')">'.PRINT_BUTTON_DESC.'</a>');
	
	$info_smarty->assign('TEXT_DESCRIPTION', TEXT_PRODUCTS_DESCRIPTION);
	$info_smarty->assign('TEXT_REVIEW', TEXT_PRODUCTS_REVIEWS.($product->getReviewsCount() > 0 ? ' ('.$product->getReviewsCount().')':''));
	$info_smarty->assign('TEXT_TELL_A_FRIEND', TEXT_PRODUCTS_TELL_A_FRIEND);
	$info_smarty->assign('TEXT_PARAMETERS', TEXT_PRODUCTS_PARAMETERS);
	$info_smarty->assign('TEXT_CROSSSESSLING', TEXT_PRODUCTS_CROSSSELLING);
	$info_smarty->assign('TEXT_MEDIA', TEXT_PRODUCTS_MEDIA);
	$info_smarty->assign('TEXT_ALSO_PURCHASED', TEXT_PRODUCTS_ALSO_PURCHASED);
	$info_smarty->assign('TEXT_LAST_VIEWED', TEXT_PRODUCTS_LAST_VIEWED);
	$info_smarty->assign('TEXT_REVERSE_CROSSSESSLING', TEXT_PRODUCTS_REVERSE_CROSSSESSLING);

	$info_smarty->assign('template_name', CURRENT_TEMPLATE.'/html/product_info_'.$product->data['products_info'].'.html');

	if($product->data['products_treepodia'] == 1 || $product->data['products_movie_url']) {
		if($product->data['products_treepodia'] == 1) {
			if(TREEPODIA_VIDEO_OPTIONS == 'overlay')
				$t_button .= '<li class="video_button"><a id="video-btn" href="javascript:showVideoDialog(\''.$product->data['products_name'].'\', video)">Video ansehen</a></li>';
			elseif(TREEPODIA_VIDEO_OPTIONS == 'embedded')
				$end .= '<div id="video-player-location"></div>';
			$get[] = 'treepodia=video';
		}
		$flash  = '<ul class="product_info_misc">';
		$flash .= $t_button;
		if(!empty($product->data['products_movie_url'])) {
			if(strpos($product->data['products_movie_url'], 'youtu'))
				$f_name = 'Youtube';
			elseif(strpos($product->data['products_movie_url'], 'vimeo'))
				$f_name = 'Vimeo';
			elseif(strpos($product->data['products_movie_url'], 'myvideo'))
				$f_name = 'MyVideo';
			$flash .= '<li class="video_button '.strtolower($f_name).'"><a class="video" title="'.$f_name.' Video zu '.$product->data['products_name'].'" href="'.$product->data['products_movie_url'].'" rel="prettyPhoto"></a></li>';
			$get[] = 'video=flash';
		}
		$flash .= '</ul>';
		$flash .= $end;
		$info_smarty->assign('PRODUCTS_FLASH', $flash);
	}
	
	$info_smarty->assign('PRODUCTS_DESCRIPTION', $product->data['products_description']);
	$info_smarty->assign('PRODUCTS_SHORT_DESCRIPTION', $product->data['products_short_description']);
	
	$additional = $db->db_query("SELECT
									additional_title,
									additional_desc
								FROM
									".TABLE_PRODUCTS_ADDITIONAL_TEXT."
								WHERE
									products_id = '".$product->data['products_id']."'
								AND
									languages_id = '".$_SESSION['languages_id']."'
								AND
									status = '1'");
	if($additional->_numOfRows) {
		while(!$additional->EOF) {
			$tab_name[] = array('title' => $additional->fields['additional_title'],
								'id' => get_url_friendly_text($additional->fields['additional_title']),
								'content' => $additional->fields['additional_desc']);
			$additional->MoveNext();
		}
		$info_smarty->assign('additional_desc', $tab_name);
	}
	
	if(!empty($product->data['products_image']) && empty($product->data['products_usk'])) {
		$images = array();
		
		if($product->data['products_image'] !='') {
			if(file_exists(DIR_WS_INFO_IMAGES.$product->data['products_image'])) {
				$images[] = array(	'name' => $product->data['products_image'],
									'nr' => 0,
									'path_icon' => DIR_WS_ICON_IMAGES.$product->data['products_image'],
									'path_info' => DIR_WS_INFO_IMAGES.$product->data['products_image'],
									'path_popup' => DIR_WS_POPUP_IMAGES.$product->data['products_image'],
									'dimension_icon' => get_img_size(DIR_WS_ICON_IMAGES.$product->data['products_image']),
									'dimension_info' => get_img_size(DIR_WS_INFO_IMAGES.$product->data['products_image']),
									'alt' => ($product->data['products_img_alt']!=''?$product->data['products_img_alt']:$product->data['products_name']));
				$cnt_img = 1;
			}
		}
		$mo_images = $db->db_query("SELECT
										image_id, image_nr, image_name, alt_langID_".$_SESSION['languages_id']."
									FROM
										".TABLE_PRODUCTS_IMAGES."
									WHERE
										products_id = '" . $product->data['products_id'] ."'
									ORDER BY
										image_nr");

		if($mo_images->_numOfRows) {
			$more_images = array();
			while(!$mo_images->EOF) {
				if(file_exists(DIR_WS_INFO_IMAGES.$mo_images->fields['image_name'])) {
				$more_images[] = array(	'name' => $mo_images->fields['image_name'],
										'nr' => $mo_images->fields['image_nr'],
										'path_icon' => DIR_WS_ICON_IMAGES.$mo_images->fields['image_name'],
										'path_info' => DIR_WS_INFO_IMAGES.$mo_images->fields['image_name'],
										'path_popup' => DIR_WS_POPUP_IMAGES.$mo_images->fields['image_name'],
										'dimension' => get_img_size(DIR_WS_ICON_IMAGES.$mo_images->fields['image_name']),
										'alt' => ($mo_images->fields['alt_langID_'.$_SESSION['languages_id']]!='')?$mo_images->fields['alt_langID_'.$_SESSION['languages_id']]:$product->data['products_name']);
					$cnt_img++;
				}
				$mo_images->MoveNext();
			}
		}
		$get[] = 'cpp='.$cnt_img;
		if(is_array($more_images))
			$info_smarty->assign('images', array_merge($images, $more_images));
		else
			$info_smarty->assign('images', $images);
	
	} elseif($product->data['products_fsk18'] == 1 && !empty($product->data['products_usk'])) {
		$images = array();
		$images[] = array(	'name' => 'USK '.$product->data['products_usk'],
							'nr' => 0,
							'path_icon' => DIR_WS_ICONS.'usk/usk_'.$product->data['products_usk'].'.png',
							'path_info' => DIR_WS_ICONS.'usk/usk_'.$product->data['products_usk'].'.png',
							'path_popup' => DIR_WS_ICONS.'usk/usk_'.$product->data['products_usk'].'.png',
							'dimension' => get_img_size(DIR_WS_ICONS.'usk/usk_'.$product->data['products_usk'].'.png'),
							'alt' => ($product->data['products_img_alt']!=''?$product->data['products_img_alt']:$product->data['products_name']));

		$info_smarty->assign('images', $images);
	}
	
  // add information from paths
  $images = array();	
  $paths = getImagePaths(DIR_WS_PRODUCTS_IMAGES, 'DIR_WS');
	foreach($info_smarty->getTemplateVars('images') as $k => $v) {
    foreach($paths as $path) {
      $path_arr = explode('_', $path);
      $path_part = $path_arr[0];
      
      if ($path_part != 'original') {
        if (!isset($v['path_'.$path_part]))
          $v['path_'.$path_part] = DIR_WS_PRODUCTS_IMAGES.$path.DIRECTORY_SEPARATOR.$v['name'];
        if (!isset($v['dimension'.$path_part]))
          $v['dimension_'.$path_part] = get_img_size(DIR_WS_PRODUCTS_IMAGES.$path.DIRECTORY_SEPARATOR.$v['name']);
      }
    }
    $images[] = $v;
  }
	$info_smarty->assign('images', $images);

//echo_e($images, 'E');
	$discount = 0.00;
	if ($_SESSION['customers_status']['customers_status_public'] == 1 && $_SESSION['customers_status']['customers_status_discount'] != '0.00') {
		$discount = $_SESSION['customers_status']['customers_status_discount'];
		if ($product->data['products_discount_allowed'] < $_SESSION['customers_status']['customers_status_discount'])
			$discount = $product->data['products_discount_allowed'];
		if ($discount != '0.00')
			$info_smarty->assign('PRODUCTS_DISCOUNT', $discount.'%');
	}
	
	if(!empty($product->data['products_content_id']) && $product->data['products_content_id'] > 0) {
		$get_content = $db->db_query("SELECT 
											content_title,
											content_heading, 
											content_text 
			
      							FROM 
											".TABLE_CONTENT_MANAGER." 
										WHERE
											content_group = '".(int)$product->data['products_content_id']."' 
										AND 
											languages_id = '".(int)$_SESSION['languages_id']."'");
											
		$info_smarty->assign('PRODUCTS_CONTENT', '<h2>'.$get_content->fields['content_heading'].'</h2>'.$get_content->fields['content_text']);
		$info_smarty->assign('TEXT_CONTENT', $get_content->fields['content_title']);
	}
	
	$msg = $_GET['msg'];
	if($_SESSION['customers_status']['customers_status_read_reviews'] != 0) {
		require_once(DIR_FS_INC.'inc.get_review_score.php'); 
		$review_count = $product->getReviewsCount();
		if($review_count > 0) {
			$score = get_review_score($product->data['products_id'], $review_count);
			$info_smarty->assign('REVIEWS_COUNT', '<img height="19" width="100" src="templates/'.CURRENT_TEMPLATE.'/img/stars_'.$score.'.png" alt="'.$review_count.' '.TEXT_PRODUCTS_REVIEWS.'" title="'.$review_count.' '.TEXT_PRODUCTS_REVIEWS.'" />
									<br />'.$schema->ItemProp('aggregaterating_main_1', $score).$schema->ItemProp('aggregaterating_main_2', $review_count).' 
									<a class="product_info_reviews_button" href="'.href_link(FILENAME_PRODUCT_INFO, 'products_id='.$product->data['products_id']).'#reviews">'.TEXT_PRODUCTS_REVIEWS.'</a>');
		}
		include(DIR_WS_MODULES.'product_reviews.php');
	}
	if (not_null($product->data['products_url']))
		$info_smarty->assign('PRODUCTS_URL', sprintf(TEXT_MORE_INFORMATION, href_link(FILENAME_REDIRECT, 'action=product&id='.$product->data['products_id'], 'NONSSL', true, false)));

	if ($product->data['products_date_available'] > date('Y-m-d H:i:s'))
		$info_smarty->assign('PRODUCTS_DATE_AVIABLE', sprintf(TEXT_DATE_AVAILABLE, date_long($product->data['products_date_available'])));
	else {
		if ($product->data['products_date_added'] != '0000-00-00 00:00:00')
			$info_smarty->assign('PRODUCTS_ADDED', sprintf(TEXT_DATE_ADDED, date_long($product->data['products_date_added'])));
	}

	if ($_SESSION['customers_status']['customers_status_graduated_prices'] == 1)
		include(DIR_WS_MODULES.FILENAME_GRADUATED_PRICE);

	include(DIR_WS_MODULES.'product_attributes.php');
	include(DIR_WS_MODULES.'product_parameters.php');
	if($product->data['products_ask_to_product'] == 1) {
		$info_smarty->assign('TEXT_ASK', TEXT_PRODUCTS_ASK);
		include(DIR_WS_MODULES.'product_ask.php');
	}
	if($product->data['products_tell_a_friend'] == 1) {
		$info_smarty->assign('PRODUCTS_TELL', '<a title="'.$product->data['products_name'].' '.TELL_BUTTON_DESC.'" href="'.href_link(FILENAME_PRODUCT_INFO, 'products_id='.$product->data['products_id']).'#tell_a_friend" class="product_info_tell_a_friend_button">'.TELL_BUTTON_DESC.'</a>');
		include(DIR_WS_MODULES.'product_tell_a_friend.php');
	}
		
	include(DIR_WS_MODULES.FILENAME_PRODUCTS_MEDIA);
	include(DIR_WS_MODULES.FILENAME_ALSO_PURCHASED_PRODUCTS);
	include(DIR_WS_MODULES.FILENAME_CROSS_SELLING);
	include(DIR_WS_MODULES.FILENAME_PRODUCTS_RELATED_CAT);

	if (file_exists(DIR_WS_MODULES.'product_models.php')) {
  	add_js_plugin('jCarousel');
    include(DIR_WS_MODULES.'product_models.php');
    //echo_e($info_smarty->getTemplateVars('MODULE_product_models'), 'E');
  }

  if (isset($_GET['tmpl']) && !preg_match('/[^a-z_]/', $_GET['tmpl'])) {
    $product->data['product_template'] = 'product_'.$_GET['tmpl'].'.html';
  }

	if ($product->data['product_template'] == '' || $product->data['product_template'] == 'default') {
		$files = array();
		if ($dir = opendir(DIR_FS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/module/product_info/')) {
			while ($file = readdir($dir)) {
				if (is_file(DIR_FS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/module/product_info/'.$file) && ($file != "index.html") && (substr($file, 0, 1) !="."))
					$files[] = array ('id' => $file, 'text' => $file);
			}
			closedir($dir);
		}
		$product->data['product_template'] = $files[0]['id'];
	}
	
	$_pathinfo_template = pathinfo($product->data['product_template']);
	$info_smarty->assign('TEMPLATE_FILE', $_pathinfo_template['filename']);
//echo_e(	$info_smarty->getTemplateVars(), 'E');

	// Konfigurator anzeigen
	if (KONFIGURATOR_ENABLE == 'true') {
    $konfigurator_button = href_link('product_info.php', 'products_id='.$product->data['products_id']);
    $konfigurator_button_array = explode('/', $konfigurator_button);
    $seo_product = array_pop($konfigurator_button_array);
    $konfigurator_button = implode('/', array_merge($konfigurator_button_array, array('konfigurator_stuhl', $seo_product)));
    $info_smarty->assign('ADD_KONFIGURATOR_BUTTON', $konfigurator_button);

		include_once(DIR_WS_CLASSES.'class.product_konfigurator.php');
		$konfigurator = new product_konfigurator($product->data['products_id']);
		$option_groups = $konfigurator->get_groups();
//echo_e($option_groups, 'E');

  	if ($product->data['product_template'] != ''
        && strpos($product->data['product_template'], 'product_konfigurator_') === 0) {

  		foreach($option_groups as $id => $option_group) {
        $konfigurator->assign_template($info_smarty, $option_group, true);
  		}
      add_js_plugin('konfigurator');

  		//dummy img for gallery?
  		$gallery_images = $info_smarty->getTemplateVars('images');
  		if (is_array($gallery_images)) {
        if (count($gallery_images) == 1) {
          $idx = array_search('cpp=1', $get);
          $get[$idx] = 'cpp=2';
        }
      }
    }
    else {
      $option_groups = array_merge($option_groups, $konfigurator->get_groups('TECHNISCHE_FUNKTIONEN'));
  		foreach($option_groups as $id => $option_group) {
        $konfigurator->assign_template($info_smarty, $option_group, false);
  		}
    }
    if($info_smarty->getTemplateVars('LAYER_KONFIGURATOR') != '')
      $smarty->assign('LAYER_KONFIGURATOR', $info_smarty->getTemplateVars('LAYER_KONFIGURATOR'));

  }
  
	$i = count($_SESSION['tracking']['products_history']);
	if ($i > 6) {
		array_shift($_SESSION['tracking']['products_history']);
		$_SESSION['tracking']['products_history'][6] = $product->data['products_id'];
		$_SESSION['tracking']['products_history'] = array_unique($_SESSION['tracking']['products_history']);
	} else {
		$_SESSION['tracking']['products_history'][$i] = $product->data['products_id'];
		$_SESSION['tracking']['products_history'] = array_unique($_SESSION['tracking']['products_history']);
	}
	
	$info_smarty->assign('language', $_SESSION['language']);
	if (!CacheCheck()) {
		$info_smarty->caching = false;
//echo_e($product->data['product_template'], 'E');		
//echo_e(	$info_smarty->getTemplateVars(), 'E');
		$product_info = $info_smarty->fetch(CURRENT_TEMPLATE.'/module/product_info/'.$product->data['product_template']);
//echo_e($product_info, 'E');
	} else {
		$info_smarty->caching = true;
		$info_smarty->cache_lifetime = CACHE_LIFETIME;
		$info_smarty->cache_modified_check = CACHE_CHECK;
		$cache_id = $product->data['products_id'].$_SESSION['language'].$_SESSION['customers_status']['customers_status_name'].$_SESSION['currency'];
		$product_info = $info_smarty->fetch(CURRENT_TEMPLATE.'/module/product_info/'.$product->data['product_template'], $cache_id);
	}
}
$smarty->assign('main_content', $product_info);
